package com.tian.controller.management;

import com.tian.common.CommonResult;
import com.tian.common.PageResult;
import com.tian.dto.ChargeActivityConditionAddReqDto;
import com.tian.dto.ChargeActivityConditionPageReqDto;
import com.tian.dto.ChargeActivityConditionRespDto;
import com.tian.dto.ChargeActivityConditionUpdateReqDto;
import com.tian.service.ChargeActivityConditionService;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * {@code @description:} 活动条件
 *
 * @author tianwc 公众号：Java后端技术全栈
 * 在线刷题 1200+java面试题和1000+篇技术文章：<a href="https://woaijava.cc/">博客地址</a>
 * {@code @date:} 2024-08-05 22:49
 * {@code @version:} 1.0
 */
@RestController
@RequestMapping("/management/activity/condition")
@Api(tags = "活动条件 控制器")
public class ChargeActivityConditionController {

    @Resource
    private ChargeActivityConditionService chargeActivityConditionService;

    @PostMapping("/add")
    public CommonResult add(@RequestBody ChargeActivityConditionAddReqDto chargeActivityConditionAddReqDto) {
        return chargeActivityConditionService.add(chargeActivityConditionAddReqDto);
    }

    @GetMapping("/query/{id}")
    public CommonResult<ChargeActivityConditionRespDto>  find(@PathVariable("id") Integer id) {
        return chargeActivityConditionService.findById(id);
    }

    @PostMapping("/page")
    public CommonResult<PageResult<List<ChargeActivityConditionRespDto>>>  page(@RequestBody ChargeActivityConditionPageReqDto chargeActivityConditionPageReqDto) {
        return chargeActivityConditionService.page(chargeActivityConditionPageReqDto);
    }

    @PostMapping("/update")
    public CommonResult update(@RequestBody ChargeActivityConditionUpdateReqDto chargeActivityConditionUpdateReqDto) {
        return chargeActivityConditionService.update(chargeActivityConditionUpdateReqDto);
    }

    @PostMapping("/delete")
    public CommonResult delete(@RequestBody ChargeActivityConditionUpdateReqDto chargeActivityConditionUpdateReqDto) {
        return chargeActivityConditionService.delete(chargeActivityConditionUpdateReqDto);
    }
}
